import { LANG } from '@/constant'
import { getItem, setItem } from '@/utils/storage'
export default {
    namespaced: true,
    state: () => ({
        sidebarOpened: true,
        language: getItem(LANG) || 'zh'
    }),
    mutations: {
        // 控制伸缩菜单栏
        triggerSidebarOpened (state) {
            state.sidebarOpened = !state.sidebarOpened
        },
        // 设置国际化
        setLanguage(state, lang) {
            setItem(LANG, lang)
            state.language = lang
        }
    }
}
